export const Stdin: FileReadOnly :=
    native 'os::Stdin';
export const Stdout: FileWriteOnly :=
    native 'os::Stdout';
export const Stderr: FileWriteOnly :=
    native 'os::Stderr';

export function scan:
    &() => Async[String,Error]
    &() =>
        let read := Stdin.{read-string},
        if (PlatformInfo.system = 'windows'):
            (read map &(str) => str.{trim-suffix(''..\r)}),
        else:
            read;
export function print:
    &(String) => Async[unit,Error]
    &(s) => Stdout.{write-string(s)};
export function error:
    &(String) => Async[unit,Error]
    &(s) => Stderr.{write-string(s)};

export function scanln:
    &() => Async[String,Error]
    &() =>
        let read := Stdin.{read-line},
        if (PlatformInfo.system = 'windows'):
            (read map &(str) => str.{trim-suffix(''..\r)}),
        else:
            read;
export function println:
    &(String) => Async[unit,Error]
    &(l) => Stdout.{write-line(l)};
export function errorln:
    &(String) => Async[unit,Error]
    &(l) => Stderr.{write-line(l)};
